package com.study.annotation.relfect;

import java.lang.reflect.Method;

public class ReflectProcessor {
    public void processMethod(Class<?> clazz)throws Exception{
        Object o = clazz.newInstance();
/*        final Object obj = clazz.getConstructor(new Class[] {}).newInstance(new Object[] {});
        Object o = clazz.getConstructor(new Class[]{}).newInstance(new Object[]{});*/
        Method[] methods = clazz.getDeclaredMethods();
        for (Method method : methods) {
            Reflect annotation = method.getAnnotation(Reflect.class);
            if(annotation!=null){
                System.out.println("方法名"+method.getName());
                method.invoke(o,annotation.name()+"嗯嗯");
            }
        }
    }

    public static void main(String[] args) throws Exception{
        Object o = ReflectProcessor.class.newInstance();
    }
}
